package com.mobyd.mweb.common.util.paginate;

import java.util.Map;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class PaginatePrepare {

	@Value("#{global['paginate.page.size']}")
	private int pageSize;
	
	@Value("#{global['paginate.pagenavi.size']}")
	private int pagenaviSize;
	
	
	public Paginate initialize(Map<String, Object> param) {
		Paginate paginate = new Paginate();
		paginate.setPageSize(pageSize);
		paginate.initialize(param);
		return paginate;
	}
	
	public Paginate setTotalRecords(Paginate paginate, Map<String, Object> param, int totalRecords) {
		paginate.setTotalRecords(param, totalRecords);
		return paginate;
	}
	
	public Paginate initialize(Map<String, Object> param, int totalRecords) {
		Paginate paginate = new Paginate();
		paginate.setPageSize(pageSize);
		paginate.initialize(param, totalRecords);
		
		return paginate;
	}
	
	
	public Paginate initNavi(Map<String, Object> param, int totalRecords) {
		Paginate paginate = new Paginate();
		paginate.setPageSize(pagenaviSize);
		paginate.initNavi(param, totalRecords);
		
		return paginate;
	}
	
}

